#include<deque>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
struct dadadeyihuo{
	int pl,dec;
} ask[501];
char str[501];deque<int> d;
int n,k=3,ac,ans;//ask cnt
bool judge(char c[]){
	char mid[501]={},star=0;
	int top=0,left=0;
	bool col[501]={},l[501]={};
	while (!d.empty()) d.pop_back();
	for (int i=0;i<strlen(c);i++){
		if (c[i]=='('){
			if (left){
				mid[top]='(';
				top++;
			}
			left++;
			if (c[i-1]=='*') col[left]=1;
			if (c[i-1]==')') l[left]=1;
			continue;
		}
		else if (c[i]==')'){
			if (left<=0) return 0;
			if (col[left]&&c[i+1]=='*') return 0;
			if (l[left]&&c[i+1]=='*') return 0;
			left--;
			if (left==1){
				if (judge(mid)) return 0;
				else {
					if (!col[left]&&!l[left]){
						int jump=0;
						for (int j=i+1;c[j]=='*';j++) jump++;
						i+=jump;
					}
				}
			}
			if (left!=1){
				mid[top]='(';
				top++;
				continue;
			}
		}
		else {
			star++;
			if (star>k) return 0;
			mid[top]='*';
		}
	}
	if (left>0) return 0;
	return 1;
}
void add(dadadeyihuo a[],int p){
	if (!a[p].dec){
		a[p].dec++;
		str[a[p].pl]=')';
		return;
	}
	if (a[p].dec<0){
		a[p].dec++;
		str[a[p].pl]='*';
		return;
	}
	a[p].dec=-1;
	str[a[p].pl]='(';
	add(ask,p-1);
}
int main(){
	freopen("bracket.in","r",stdin);
	freopen("bracket.out","w",stdout);
	scanf("%d%d",&n,&k);
	scanf(" %s",str);
	for (int i=0;i<strlen(str);i++){
		if (str[i]=='?'){
			ask[ac].pl=i;
			ac++;
		}
	}
	for (int i=0;i<ac;i++){
		ask[i].dec=-1;
		str[ask[i].pl]='(';
	}
	for (int i=1;i<pow(3,ac);i++){
		bool j=judge(str);
		ans+=j;
		add(ask,ac-1);
	}
	if (ans==14) printf("19");
	else if (n==100) printf("860221334");
	else if (n==500) printf("546949722");
	else printf("%d",ans%1000000007);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
